package main

import (
	"CommonsProject/conf"
	"CommonsProject/models"
	"CommonsProject/router"
	"fmt"
	"log"
)

func main() {
	//初始化配置
	conf.InitConfig()
	//初始化数据库
	models.InitDatabase(conf.GlobalConfig.Mysql)
	//初始化路由
	engine := router.RouterInit(models.Database)

	//运行程序
	err := engine.Run(fmt.Sprintf(":%d", conf.GlobalConfig.Server.Port))

	if err != nil {
		log.Panicln("启动程序失败！", err.Error())
	}
}
